import mongoose from 'mongoose'

const User = mongoose.model('User')

class UserCtl {
    async create(account, pwd) {
        const repeatedUser = await User.findOne({ account });
        if (repeatedUser) ctx.throw(409, '用户已经占用')
        
        const user = await User({account, pwd}).save();

        return user;
    }
}


export const userController = new UserCtl()